package com.rh.controller;

import com.rh.entity.EduCourse;
import com.rh.entity.EduTeacher;
import com.rh.service.EduCourseService;
import com.rh.service.EduTeacherService;
import com.rh.result.ResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Banner前端显示课程名师热门数据
 */
@Api(tags = "Banner前端管理")
@RestController
@RequestMapping("/eduservice/indexfront")
public class IndexFrontController {
    @Autowired
    private EduCourseService eduCourseService;
    @Autowired
    private EduTeacherService eduTeacherService;
    /**
     * 1.查看热门数据
     */
    @GetMapping("index")
    @ApiOperation(value = "1.查看首页热门数据")
    public ResultVo index(){
        List<EduCourse> eduCourses = eduCourseService.courseList();
        List<EduTeacher> eduTeacherList = eduTeacherService.teacherList();
        return ResultVo.ok().data("eduList",eduCourses).data("teacherList",eduTeacherList);
    }
}
